﻿#region DaUsers
/*----------------------------------------------------------------
// 文件名：DaUsers.cs
// 功能描述：类Users的数据访问层
//
// 
// 创建时间：2009-07-19 DtataAccess template . Ver 5.0.20090413
//
// 修改标识： 
// 修改描述： 
//----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.Text;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

using Las.Model; 


namespace Las.Dal
{
	///可以继承更上层接口,IUsers ,数据访问层基类DaBase，
	///DaBase中包含了DbException异常处理静态方法
    public	partial  class DaUsers:DaBase<MoUsers>
    {	 
		#region SQL const
		internal const string TABLE_COLUMNS=" USEQ ,LOGIN_NAME ,USER_CODE ,ARM_TYPE ,SPECIALTY_PHASE ,BRANCH_ID ,PERSON_ID ,PERSON_NAME ,SEX_ID ,FORK_ID ,BIRTHDAY ,ENROLL_DATE ,BIRTHPLACE ,FAM_ORI_ID ,PERSON_ING_ID ,POLITY_MEMBER_ID ,CURRENTPOST_ID ,CURRENTPOSTTIME ,FIRSTDEGREE_ID ,SCHOOLSPECIAL ,CURRENTDEGREE_ID ,STRONG_SUIT ,DEGREE_ID ,TYPICAL_LEVEL ,IDENTITY_TYPE_ID ,READINESS_ID ,GRADUATEFROM ,TRAIN_INFO ,TRAIN_SCORE ,TRAIN_EVA ,ABILITY_EVA ,GOODTEACHER ,PAPER ,PARTYATTENDED ,PERSONLIB ,AWARDORPUNISH ,RESUME ,PHOTO ,USER_ID ,USER_PWD ,FULL_NAME ,POSTTYPE ,ZCBM ,ZGSF ,ENABLED ,STATE   ";
		
		internal const string SQL_INSERT="INSERT INTO MT_USERS ("+TABLE_COLUMNS+") VALUES (@Useq,@LoginName,@UserCode,@ArmType,@SpecialtyPhase,@BranchId,@PersonId,@PersonName,@SexId,@ForkId,@Birthday,@EnrollDate,@Birthplace,@FamOriId,@PersonIngId,@PolityMemberId,@CurrentpostId,@Currentposttime,@FirstdegreeId,@Schoolspecial,@CurrentdegreeId,@StrongSuit,@DegreeId,@TypicalLevel,@IdentityTypeId,@ReadinessId,@Graduatefrom,@TrainInfo,@TrainScore,@TrainEva,@AbilityEva,@Goodteacher,@Paper,@Partyattended,@Personlib,@Awardorpunish,@Resume,@Photo,@UserId,@UserPwd,@FullName,@Posttype,@Zcbm,@Zgsf,@Enabled,@State)";
		internal const string SQL_SELECT="SELECT "+TABLE_COLUMNS+" FROM MT_USERS  ";
		internal const string SQL_SELECT_ONE=SQL_SELECT+" WHERE USER_ID=@UserId";                              
		
		internal const string SQL_EXIST="SELECT COUNT(*) FROM MT_USERS  WHERE USER_ID=@UserId  ";
		internal const string SQL_UPDATE="UPDATE MT_USERS SET USEQ=@Useq, LOGIN_NAME=@LoginName, USER_CODE=@UserCode, ARM_TYPE=@ArmType, SPECIALTY_PHASE=@SpecialtyPhase, BRANCH_ID=@BranchId, PERSON_ID=@PersonId, PERSON_NAME=@PersonName, SEX_ID=@SexId, FORK_ID=@ForkId, BIRTHDAY=@Birthday, ENROLL_DATE=@EnrollDate, BIRTHPLACE=@Birthplace, FAM_ORI_ID=@FamOriId, PERSON_ING_ID=@PersonIngId, POLITY_MEMBER_ID=@PolityMemberId, CURRENTPOST_ID=@CurrentpostId, CURRENTPOSTTIME=@Currentposttime, FIRSTDEGREE_ID=@FirstdegreeId, SCHOOLSPECIAL=@Schoolspecial, CURRENTDEGREE_ID=@CurrentdegreeId, STRONG_SUIT=@StrongSuit, DEGREE_ID=@DegreeId, TYPICAL_LEVEL=@TypicalLevel, IDENTITY_TYPE_ID=@IdentityTypeId, READINESS_ID=@ReadinessId, GRADUATEFROM=@Graduatefrom, TRAIN_INFO=@TrainInfo, TRAIN_SCORE=@TrainScore, TRAIN_EVA=@TrainEva, ABILITY_EVA=@AbilityEva, GOODTEACHER=@Goodteacher, PAPER=@Paper, PARTYATTENDED=@Partyattended, PERSONLIB=@Personlib, AWARDORPUNISH=@Awardorpunish, RESUME=@Resume, PHOTO=@Photo, USER_PWD=@UserPwd, FULL_NAME=@FullName, POSTTYPE=@Posttype, ZCBM=@Zcbm, ZGSF=@Zgsf, ENABLED=@Enabled, STATE=@State WHERE USER_ID=@UserId";
		
		internal const string SQL_DELETE_DEFAULT = "DELETE FROM MT_USERS ";
		internal const string SQL_DELETE="DELETE FROM MT_USERS WHERE USER_ID=@UserId";
		
		internal const string SQL_COUNT="SELECT COUNT(*) FROM mt_users ";
		#endregion
		       
		#region Constructor
	 
		/// <summary>
        /// 默认构造函数，使用配置文件中默认的数据库配置。
        /// </summary>
		public DaUsers ()
		{ 
			this.db=DatabaseFactory.CreateDatabase();
		}
		/// <summary>
        /// 使用指定的databaseName数据库配置。
        /// </summary>
        /// <param name="databaseName">配置文件中数据库的配置名称。</param>
		public DaUsers (string databaseName)
		{ 
            this.db = DatabaseFactory.CreateDatabase(databaseName);
		} 
		
		public DaUsers (Database db)
		{ 
            this.db = db;
		} 
		
		#endregion
		
		//以下是CRUD方法，每个方法都有引入外部事务的版本

		#region 构造器模块
		
        protected override MoUsers ConstructT()
        {
            return new MoUsers();
        }
        #endregion
		
	    
		
		#region Add模块 Helper
		
		///build the command object.It never throw exception.
		protected override  DbCommand ConstructAddCommand(Database db)
		{
			DbCommand dbCommand = db.GetSqlStringCommand(SQL_INSERT);
			 
			db.AddInParameter(dbCommand,"Useq",DbType.Int32);
			db.AddInParameter(dbCommand,"LoginName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"UserCode",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ArmType",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SpecialtyPhase",DbType.AnsiString);
			db.AddInParameter(dbCommand,"BranchId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SexId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ForkId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Birthday",DbType.DateTime);
			db.AddInParameter(dbCommand,"EnrollDate",DbType.DateTime);
			db.AddInParameter(dbCommand,"Birthplace",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FamOriId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonIngId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PolityMemberId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"CurrentpostId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Currentposttime",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FirstdegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Schoolspecial",DbType.AnsiString);
			db.AddInParameter(dbCommand,"CurrentdegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"StrongSuit",DbType.AnsiString);
			db.AddInParameter(dbCommand,"DegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TypicalLevel",DbType.AnsiString);
			db.AddInParameter(dbCommand,"IdentityTypeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ReadinessId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Graduatefrom",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainInfo",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainScore",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainEva",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AbilityEva",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Goodteacher",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Paper",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Partyattended",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Personlib",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Awardorpunish",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Resume",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Photo",DbType.AnsiString);
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"UserPwd",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FullName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Posttype",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Zcbm",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Zgsf",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Enabled",DbType.AnsiString);
			db.AddInParameter(dbCommand,"State",DbType.Int32);
			return dbCommand;
		}		
		protected override DbCommand ConstructAddCommand(Database db,MoUsers entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_INSERT);			 
			db.AddInParameter(dbCommand,"Useq",DbType.Int32,entity.Useq);
			db.AddInParameter(dbCommand,"LoginName",DbType.AnsiString,entity.LoginName);
			db.AddInParameter(dbCommand,"UserCode",DbType.AnsiString,entity.UserCode);
			db.AddInParameter(dbCommand,"ArmType",DbType.AnsiString,entity.ArmType);
			db.AddInParameter(dbCommand,"SpecialtyPhase",DbType.AnsiString,entity.SpecialtyPhase);
			db.AddInParameter(dbCommand,"BranchId",DbType.AnsiString,entity.BranchId);
			db.AddInParameter(dbCommand,"PersonId",DbType.AnsiString,entity.PersonId);
			db.AddInParameter(dbCommand,"PersonName",DbType.AnsiString,entity.PersonName);
			db.AddInParameter(dbCommand,"SexId",DbType.AnsiString,entity.SexId);
			db.AddInParameter(dbCommand,"ForkId",DbType.AnsiString,entity.ForkId);
			db.AddInParameter(dbCommand,"Birthday",DbType.DateTime,entity.Birthday);
			db.AddInParameter(dbCommand,"EnrollDate",DbType.DateTime,entity.EnrollDate);
			db.AddInParameter(dbCommand,"Birthplace",DbType.AnsiString,entity.Birthplace);
			db.AddInParameter(dbCommand,"FamOriId",DbType.AnsiString,entity.FamOriId);
			db.AddInParameter(dbCommand,"PersonIngId",DbType.AnsiString,entity.PersonIngId);
			db.AddInParameter(dbCommand,"PolityMemberId",DbType.AnsiString,entity.PolityMemberId);
			db.AddInParameter(dbCommand,"CurrentpostId",DbType.AnsiString,entity.CurrentpostId);
			db.AddInParameter(dbCommand,"Currentposttime",DbType.AnsiString,entity.Currentposttime);
			db.AddInParameter(dbCommand,"FirstdegreeId",DbType.AnsiString,entity.FirstdegreeId);
			db.AddInParameter(dbCommand,"Schoolspecial",DbType.AnsiString,entity.Schoolspecial);
			db.AddInParameter(dbCommand,"CurrentdegreeId",DbType.AnsiString,entity.CurrentdegreeId);
			db.AddInParameter(dbCommand,"StrongSuit",DbType.AnsiString,entity.StrongSuit);
			db.AddInParameter(dbCommand,"DegreeId",DbType.AnsiString,entity.DegreeId);
			db.AddInParameter(dbCommand,"TypicalLevel",DbType.AnsiString,entity.TypicalLevel);
			db.AddInParameter(dbCommand,"IdentityTypeId",DbType.AnsiString,entity.IdentityTypeId);
			db.AddInParameter(dbCommand,"ReadinessId",DbType.AnsiString,entity.ReadinessId);
			db.AddInParameter(dbCommand,"Graduatefrom",DbType.AnsiString,entity.Graduatefrom);
			db.AddInParameter(dbCommand,"TrainInfo",DbType.AnsiString,entity.TrainInfo);
			db.AddInParameter(dbCommand,"TrainScore",DbType.AnsiString,entity.TrainScore);
			db.AddInParameter(dbCommand,"TrainEva",DbType.AnsiString,entity.TrainEva);
			db.AddInParameter(dbCommand,"AbilityEva",DbType.AnsiString,entity.AbilityEva);
			db.AddInParameter(dbCommand,"Goodteacher",DbType.AnsiString,entity.Goodteacher);
			db.AddInParameter(dbCommand,"Paper",DbType.AnsiString,entity.Paper);
			db.AddInParameter(dbCommand,"Partyattended",DbType.AnsiString,entity.Partyattended);
			db.AddInParameter(dbCommand,"Personlib",DbType.AnsiString,entity.Personlib);
			db.AddInParameter(dbCommand,"Awardorpunish",DbType.AnsiString,entity.Awardorpunish);
			db.AddInParameter(dbCommand,"Resume",DbType.AnsiString,entity.Resume);
			db.AddInParameter(dbCommand,"Photo",DbType.AnsiString,entity.Photo);
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString,entity.UserId);
			db.AddInParameter(dbCommand,"UserPwd",DbType.AnsiString,entity.UserPwd);
			db.AddInParameter(dbCommand,"FullName",DbType.AnsiString,entity.FullName);
			db.AddInParameter(dbCommand,"Posttype",DbType.AnsiString,entity.Posttype);
			db.AddInParameter(dbCommand,"Zcbm",DbType.AnsiString,entity.Zcbm);
			db.AddInParameter(dbCommand,"Zgsf",DbType.AnsiString,entity.Zgsf);
			db.AddInParameter(dbCommand,"Enabled",DbType.AnsiString,entity.Enabled);
			db.AddInParameter(dbCommand,"State",DbType.Int32,entity.State);
			return dbCommand;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,MoUsers entity)
		{
			db.SetParameterValue(addCmd,"Useq",entity.Useq);
			db.SetParameterValue(addCmd,"LoginName",entity.LoginName);
			db.SetParameterValue(addCmd,"UserCode",entity.UserCode);
			db.SetParameterValue(addCmd,"ArmType",entity.ArmType);
			db.SetParameterValue(addCmd,"SpecialtyPhase",entity.SpecialtyPhase);
			db.SetParameterValue(addCmd,"BranchId",entity.BranchId);
			db.SetParameterValue(addCmd,"PersonId",entity.PersonId);
			db.SetParameterValue(addCmd,"PersonName",entity.PersonName);
			db.SetParameterValue(addCmd,"SexId",entity.SexId);
			db.SetParameterValue(addCmd,"ForkId",entity.ForkId);
			db.SetParameterValue(addCmd,"Birthday",entity.Birthday);
			db.SetParameterValue(addCmd,"EnrollDate",entity.EnrollDate);
			db.SetParameterValue(addCmd,"Birthplace",entity.Birthplace);
			db.SetParameterValue(addCmd,"FamOriId",entity.FamOriId);
			db.SetParameterValue(addCmd,"PersonIngId",entity.PersonIngId);
			db.SetParameterValue(addCmd,"PolityMemberId",entity.PolityMemberId);
			db.SetParameterValue(addCmd,"CurrentpostId",entity.CurrentpostId);
			db.SetParameterValue(addCmd,"Currentposttime",entity.Currentposttime);
			db.SetParameterValue(addCmd,"FirstdegreeId",entity.FirstdegreeId);
			db.SetParameterValue(addCmd,"Schoolspecial",entity.Schoolspecial);
			db.SetParameterValue(addCmd,"CurrentdegreeId",entity.CurrentdegreeId);
			db.SetParameterValue(addCmd,"StrongSuit",entity.StrongSuit);
			db.SetParameterValue(addCmd,"DegreeId",entity.DegreeId);
			db.SetParameterValue(addCmd,"TypicalLevel",entity.TypicalLevel);
			db.SetParameterValue(addCmd,"IdentityTypeId",entity.IdentityTypeId);
			db.SetParameterValue(addCmd,"ReadinessId",entity.ReadinessId);
			db.SetParameterValue(addCmd,"Graduatefrom",entity.Graduatefrom);
			db.SetParameterValue(addCmd,"TrainInfo",entity.TrainInfo);
			db.SetParameterValue(addCmd,"TrainScore",entity.TrainScore);
			db.SetParameterValue(addCmd,"TrainEva",entity.TrainEva);
			db.SetParameterValue(addCmd,"AbilityEva",entity.AbilityEva);
			db.SetParameterValue(addCmd,"Goodteacher",entity.Goodteacher);
			db.SetParameterValue(addCmd,"Paper",entity.Paper);
			db.SetParameterValue(addCmd,"Partyattended",entity.Partyattended);
			db.SetParameterValue(addCmd,"Personlib",entity.Personlib);
			db.SetParameterValue(addCmd,"Awardorpunish",entity.Awardorpunish);
			db.SetParameterValue(addCmd,"Resume",entity.Resume);
			db.SetParameterValue(addCmd,"Photo",entity.Photo);
			db.SetParameterValue(addCmd,"UserId",entity.UserId);
			db.SetParameterValue(addCmd,"UserPwd",entity.UserPwd);
			db.SetParameterValue(addCmd,"FullName",entity.FullName);
			db.SetParameterValue(addCmd,"Posttype",entity.Posttype);
			db.SetParameterValue(addCmd,"Zcbm",entity.Zcbm);
			db.SetParameterValue(addCmd,"Zgsf",entity.Zgsf);
			db.SetParameterValue(addCmd,"Enabled",entity.Enabled);
			db.SetParameterValue(addCmd,"State",entity.State);
			return addCmd;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,DataRow row)
		{
			db.SetParameterValue(addCmd,"Useq",row["Useq"]);
			db.SetParameterValue(addCmd,"LoginName",row["LoginName"]);
			db.SetParameterValue(addCmd,"UserCode",row["UserCode"]);
			db.SetParameterValue(addCmd,"ArmType",row["ArmType"]);
			db.SetParameterValue(addCmd,"SpecialtyPhase",row["SpecialtyPhase"]);
			db.SetParameterValue(addCmd,"BranchId",row["BranchId"]);
			db.SetParameterValue(addCmd,"PersonId",row["PersonId"]);
			db.SetParameterValue(addCmd,"PersonName",row["PersonName"]);
			db.SetParameterValue(addCmd,"SexId",row["SexId"]);
			db.SetParameterValue(addCmd,"ForkId",row["ForkId"]);
			db.SetParameterValue(addCmd,"Birthday",row["Birthday"]);
			db.SetParameterValue(addCmd,"EnrollDate",row["EnrollDate"]);
			db.SetParameterValue(addCmd,"Birthplace",row["Birthplace"]);
			db.SetParameterValue(addCmd,"FamOriId",row["FamOriId"]);
			db.SetParameterValue(addCmd,"PersonIngId",row["PersonIngId"]);
			db.SetParameterValue(addCmd,"PolityMemberId",row["PolityMemberId"]);
			db.SetParameterValue(addCmd,"CurrentpostId",row["CurrentpostId"]);
			db.SetParameterValue(addCmd,"Currentposttime",row["Currentposttime"]);
			db.SetParameterValue(addCmd,"FirstdegreeId",row["FirstdegreeId"]);
			db.SetParameterValue(addCmd,"Schoolspecial",row["Schoolspecial"]);
			db.SetParameterValue(addCmd,"CurrentdegreeId",row["CurrentdegreeId"]);
			db.SetParameterValue(addCmd,"StrongSuit",row["StrongSuit"]);
			db.SetParameterValue(addCmd,"DegreeId",row["DegreeId"]);
			db.SetParameterValue(addCmd,"TypicalLevel",row["TypicalLevel"]);
			db.SetParameterValue(addCmd,"IdentityTypeId",row["IdentityTypeId"]);
			db.SetParameterValue(addCmd,"ReadinessId",row["ReadinessId"]);
			db.SetParameterValue(addCmd,"Graduatefrom",row["Graduatefrom"]);
			db.SetParameterValue(addCmd,"TrainInfo",row["TrainInfo"]);
			db.SetParameterValue(addCmd,"TrainScore",row["TrainScore"]);
			db.SetParameterValue(addCmd,"TrainEva",row["TrainEva"]);
			db.SetParameterValue(addCmd,"AbilityEva",row["AbilityEva"]);
			db.SetParameterValue(addCmd,"Goodteacher",row["Goodteacher"]);
			db.SetParameterValue(addCmd,"Paper",row["Paper"]);
			db.SetParameterValue(addCmd,"Partyattended",row["Partyattended"]);
			db.SetParameterValue(addCmd,"Personlib",row["Personlib"]);
			db.SetParameterValue(addCmd,"Awardorpunish",row["Awardorpunish"]);
			db.SetParameterValue(addCmd,"Resume",row["Resume"]);
			db.SetParameterValue(addCmd,"Photo",row["Photo"]);
			db.SetParameterValue(addCmd,"UserId",row["UserId"]);
			db.SetParameterValue(addCmd,"UserPwd",row["UserPwd"]);
			db.SetParameterValue(addCmd,"FullName",row["FullName"]);
			db.SetParameterValue(addCmd,"Posttype",row["Posttype"]);
			db.SetParameterValue(addCmd,"Zcbm",row["Zcbm"]);
			db.SetParameterValue(addCmd,"Zgsf",row["Zgsf"]);
			db.SetParameterValue(addCmd,"Enabled",row["Enabled"]);
			db.SetParameterValue(addCmd,"State",row["State"]);
			return addCmd;
		}
		
		#endregion
		    
		#region Update模块 Helper
		
		protected override DbCommand ConstructUpdateCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"Useq",DbType.Int32);
			db.AddInParameter(dbCommand,"LoginName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"UserCode",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ArmType",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SpecialtyPhase",DbType.AnsiString);
			db.AddInParameter(dbCommand,"BranchId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SexId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ForkId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Birthday",DbType.DateTime);
			db.AddInParameter(dbCommand,"EnrollDate",DbType.DateTime);
			db.AddInParameter(dbCommand,"Birthplace",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FamOriId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PersonIngId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PolityMemberId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"CurrentpostId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Currentposttime",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FirstdegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Schoolspecial",DbType.AnsiString);
			db.AddInParameter(dbCommand,"CurrentdegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"StrongSuit",DbType.AnsiString);
			db.AddInParameter(dbCommand,"DegreeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TypicalLevel",DbType.AnsiString);
			db.AddInParameter(dbCommand,"IdentityTypeId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ReadinessId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Graduatefrom",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainInfo",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainScore",DbType.AnsiString);
			db.AddInParameter(dbCommand,"TrainEva",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AbilityEva",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Goodteacher",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Paper",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Partyattended",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Personlib",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Awardorpunish",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Resume",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Photo",DbType.AnsiString);
			db.AddInParameter(dbCommand,"UserPwd",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FullName",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Posttype",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Zcbm",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Zgsf",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Enabled",DbType.AnsiString);
			db.AddInParameter(dbCommand,"State",DbType.Int32);
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString);
			 
			return dbCommand;
		}
		protected override DbCommand ConstructUpdateCommand(Database db,MoUsers entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"Useq",DbType.Int32,entity.Useq);
			db.AddInParameter(dbCommand,"LoginName",DbType.AnsiString,entity.LoginName);
			db.AddInParameter(dbCommand,"UserCode",DbType.AnsiString,entity.UserCode);
			db.AddInParameter(dbCommand,"ArmType",DbType.AnsiString,entity.ArmType);
			db.AddInParameter(dbCommand,"SpecialtyPhase",DbType.AnsiString,entity.SpecialtyPhase);
			db.AddInParameter(dbCommand,"BranchId",DbType.AnsiString,entity.BranchId);
			db.AddInParameter(dbCommand,"PersonId",DbType.AnsiString,entity.PersonId);
			db.AddInParameter(dbCommand,"PersonName",DbType.AnsiString,entity.PersonName);
			db.AddInParameter(dbCommand,"SexId",DbType.AnsiString,entity.SexId);
			db.AddInParameter(dbCommand,"ForkId",DbType.AnsiString,entity.ForkId);
			db.AddInParameter(dbCommand,"Birthday",DbType.DateTime,entity.Birthday);
			db.AddInParameter(dbCommand,"EnrollDate",DbType.DateTime,entity.EnrollDate);
			db.AddInParameter(dbCommand,"Birthplace",DbType.AnsiString,entity.Birthplace);
			db.AddInParameter(dbCommand,"FamOriId",DbType.AnsiString,entity.FamOriId);
			db.AddInParameter(dbCommand,"PersonIngId",DbType.AnsiString,entity.PersonIngId);
			db.AddInParameter(dbCommand,"PolityMemberId",DbType.AnsiString,entity.PolityMemberId);
			db.AddInParameter(dbCommand,"CurrentpostId",DbType.AnsiString,entity.CurrentpostId);
			db.AddInParameter(dbCommand,"Currentposttime",DbType.AnsiString,entity.Currentposttime);
			db.AddInParameter(dbCommand,"FirstdegreeId",DbType.AnsiString,entity.FirstdegreeId);
			db.AddInParameter(dbCommand,"Schoolspecial",DbType.AnsiString,entity.Schoolspecial);
			db.AddInParameter(dbCommand,"CurrentdegreeId",DbType.AnsiString,entity.CurrentdegreeId);
			db.AddInParameter(dbCommand,"StrongSuit",DbType.AnsiString,entity.StrongSuit);
			db.AddInParameter(dbCommand,"DegreeId",DbType.AnsiString,entity.DegreeId);
			db.AddInParameter(dbCommand,"TypicalLevel",DbType.AnsiString,entity.TypicalLevel);
			db.AddInParameter(dbCommand,"IdentityTypeId",DbType.AnsiString,entity.IdentityTypeId);
			db.AddInParameter(dbCommand,"ReadinessId",DbType.AnsiString,entity.ReadinessId);
			db.AddInParameter(dbCommand,"Graduatefrom",DbType.AnsiString,entity.Graduatefrom);
			db.AddInParameter(dbCommand,"TrainInfo",DbType.AnsiString,entity.TrainInfo);
			db.AddInParameter(dbCommand,"TrainScore",DbType.AnsiString,entity.TrainScore);
			db.AddInParameter(dbCommand,"TrainEva",DbType.AnsiString,entity.TrainEva);
			db.AddInParameter(dbCommand,"AbilityEva",DbType.AnsiString,entity.AbilityEva);
			db.AddInParameter(dbCommand,"Goodteacher",DbType.AnsiString,entity.Goodteacher);
			db.AddInParameter(dbCommand,"Paper",DbType.AnsiString,entity.Paper);
			db.AddInParameter(dbCommand,"Partyattended",DbType.AnsiString,entity.Partyattended);
			db.AddInParameter(dbCommand,"Personlib",DbType.AnsiString,entity.Personlib);
			db.AddInParameter(dbCommand,"Awardorpunish",DbType.AnsiString,entity.Awardorpunish);
			db.AddInParameter(dbCommand,"Resume",DbType.AnsiString,entity.Resume);
			db.AddInParameter(dbCommand,"Photo",DbType.AnsiString,entity.Photo);
			db.AddInParameter(dbCommand,"UserPwd",DbType.AnsiString,entity.UserPwd);
			db.AddInParameter(dbCommand,"FullName",DbType.AnsiString,entity.FullName);
			db.AddInParameter(dbCommand,"Posttype",DbType.AnsiString,entity.Posttype);
			db.AddInParameter(dbCommand,"Zcbm",DbType.AnsiString,entity.Zcbm);
			db.AddInParameter(dbCommand,"Zgsf",DbType.AnsiString,entity.Zgsf);
			db.AddInParameter(dbCommand,"Enabled",DbType.AnsiString,entity.Enabled);
			db.AddInParameter(dbCommand,"State",DbType.Int32,entity.State);
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString,entity.UserId);
			 
			return dbCommand;
		}
		
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,MoUsers entity)
		{
			db.SetParameterValue(updateCmd,"Useq",entity.Useq);
			db.SetParameterValue(updateCmd,"LoginName",entity.LoginName);
			db.SetParameterValue(updateCmd,"UserCode",entity.UserCode);
			db.SetParameterValue(updateCmd,"ArmType",entity.ArmType);
			db.SetParameterValue(updateCmd,"SpecialtyPhase",entity.SpecialtyPhase);
			db.SetParameterValue(updateCmd,"BranchId",entity.BranchId);
			db.SetParameterValue(updateCmd,"PersonId",entity.PersonId);
			db.SetParameterValue(updateCmd,"PersonName",entity.PersonName);
			db.SetParameterValue(updateCmd,"SexId",entity.SexId);
			db.SetParameterValue(updateCmd,"ForkId",entity.ForkId);
			db.SetParameterValue(updateCmd,"Birthday",entity.Birthday);
			db.SetParameterValue(updateCmd,"EnrollDate",entity.EnrollDate);
			db.SetParameterValue(updateCmd,"Birthplace",entity.Birthplace);
			db.SetParameterValue(updateCmd,"FamOriId",entity.FamOriId);
			db.SetParameterValue(updateCmd,"PersonIngId",entity.PersonIngId);
			db.SetParameterValue(updateCmd,"PolityMemberId",entity.PolityMemberId);
			db.SetParameterValue(updateCmd,"CurrentpostId",entity.CurrentpostId);
			db.SetParameterValue(updateCmd,"Currentposttime",entity.Currentposttime);
			db.SetParameterValue(updateCmd,"FirstdegreeId",entity.FirstdegreeId);
			db.SetParameterValue(updateCmd,"Schoolspecial",entity.Schoolspecial);
			db.SetParameterValue(updateCmd,"CurrentdegreeId",entity.CurrentdegreeId);
			db.SetParameterValue(updateCmd,"StrongSuit",entity.StrongSuit);
			db.SetParameterValue(updateCmd,"DegreeId",entity.DegreeId);
			db.SetParameterValue(updateCmd,"TypicalLevel",entity.TypicalLevel);
			db.SetParameterValue(updateCmd,"IdentityTypeId",entity.IdentityTypeId);
			db.SetParameterValue(updateCmd,"ReadinessId",entity.ReadinessId);
			db.SetParameterValue(updateCmd,"Graduatefrom",entity.Graduatefrom);
			db.SetParameterValue(updateCmd,"TrainInfo",entity.TrainInfo);
			db.SetParameterValue(updateCmd,"TrainScore",entity.TrainScore);
			db.SetParameterValue(updateCmd,"TrainEva",entity.TrainEva);
			db.SetParameterValue(updateCmd,"AbilityEva",entity.AbilityEva);
			db.SetParameterValue(updateCmd,"Goodteacher",entity.Goodteacher);
			db.SetParameterValue(updateCmd,"Paper",entity.Paper);
			db.SetParameterValue(updateCmd,"Partyattended",entity.Partyattended);
			db.SetParameterValue(updateCmd,"Personlib",entity.Personlib);
			db.SetParameterValue(updateCmd,"Awardorpunish",entity.Awardorpunish);
			db.SetParameterValue(updateCmd,"Resume",entity.Resume);
			db.SetParameterValue(updateCmd,"Photo",entity.Photo);
			db.SetParameterValue(updateCmd,"UserPwd",entity.UserPwd);
			db.SetParameterValue(updateCmd,"FullName",entity.FullName);
			db.SetParameterValue(updateCmd,"Posttype",entity.Posttype);
			db.SetParameterValue(updateCmd,"Zcbm",entity.Zcbm);
			db.SetParameterValue(updateCmd,"Zgsf",entity.Zgsf);
			db.SetParameterValue(updateCmd,"Enabled",entity.Enabled);
			db.SetParameterValue(updateCmd,"State",entity.State);
			db.SetParameterValue(updateCmd,"UserId",entity.UserId);
			return updateCmd;
		}
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,DataRow row)
		{
			db.SetParameterValue(updateCmd,"Useq",row["Useq"]);
			db.SetParameterValue(updateCmd,"LoginName",row["LoginName"]);
			db.SetParameterValue(updateCmd,"UserCode",row["UserCode"]);
			db.SetParameterValue(updateCmd,"ArmType",row["ArmType"]);
			db.SetParameterValue(updateCmd,"SpecialtyPhase",row["SpecialtyPhase"]);
			db.SetParameterValue(updateCmd,"BranchId",row["BranchId"]);
			db.SetParameterValue(updateCmd,"PersonId",row["PersonId"]);
			db.SetParameterValue(updateCmd,"PersonName",row["PersonName"]);
			db.SetParameterValue(updateCmd,"SexId",row["SexId"]);
			db.SetParameterValue(updateCmd,"ForkId",row["ForkId"]);
			db.SetParameterValue(updateCmd,"Birthday",row["Birthday"]);
			db.SetParameterValue(updateCmd,"EnrollDate",row["EnrollDate"]);
			db.SetParameterValue(updateCmd,"Birthplace",row["Birthplace"]);
			db.SetParameterValue(updateCmd,"FamOriId",row["FamOriId"]);
			db.SetParameterValue(updateCmd,"PersonIngId",row["PersonIngId"]);
			db.SetParameterValue(updateCmd,"PolityMemberId",row["PolityMemberId"]);
			db.SetParameterValue(updateCmd,"CurrentpostId",row["CurrentpostId"]);
			db.SetParameterValue(updateCmd,"Currentposttime",row["Currentposttime"]);
			db.SetParameterValue(updateCmd,"FirstdegreeId",row["FirstdegreeId"]);
			db.SetParameterValue(updateCmd,"Schoolspecial",row["Schoolspecial"]);
			db.SetParameterValue(updateCmd,"CurrentdegreeId",row["CurrentdegreeId"]);
			db.SetParameterValue(updateCmd,"StrongSuit",row["StrongSuit"]);
			db.SetParameterValue(updateCmd,"DegreeId",row["DegreeId"]);
			db.SetParameterValue(updateCmd,"TypicalLevel",row["TypicalLevel"]);
			db.SetParameterValue(updateCmd,"IdentityTypeId",row["IdentityTypeId"]);
			db.SetParameterValue(updateCmd,"ReadinessId",row["ReadinessId"]);
			db.SetParameterValue(updateCmd,"Graduatefrom",row["Graduatefrom"]);
			db.SetParameterValue(updateCmd,"TrainInfo",row["TrainInfo"]);
			db.SetParameterValue(updateCmd,"TrainScore",row["TrainScore"]);
			db.SetParameterValue(updateCmd,"TrainEva",row["TrainEva"]);
			db.SetParameterValue(updateCmd,"AbilityEva",row["AbilityEva"]);
			db.SetParameterValue(updateCmd,"Goodteacher",row["Goodteacher"]);
			db.SetParameterValue(updateCmd,"Paper",row["Paper"]);
			db.SetParameterValue(updateCmd,"Partyattended",row["Partyattended"]);
			db.SetParameterValue(updateCmd,"Personlib",row["Personlib"]);
			db.SetParameterValue(updateCmd,"Awardorpunish",row["Awardorpunish"]);
			db.SetParameterValue(updateCmd,"Resume",row["Resume"]);
			db.SetParameterValue(updateCmd,"Photo",row["Photo"]);
			db.SetParameterValue(updateCmd,"UserPwd",row["UserPwd"]);
			db.SetParameterValue(updateCmd,"FullName",row["FullName"]);
			db.SetParameterValue(updateCmd,"Posttype",row["Posttype"]);
			db.SetParameterValue(updateCmd,"Zcbm",row["Zcbm"]);
			db.SetParameterValue(updateCmd,"Zgsf",row["Zgsf"]);
			db.SetParameterValue(updateCmd,"Enabled",row["Enabled"]);
			db.SetParameterValue(updateCmd,"State",row["State"]);
			db.SetParameterValue(updateCmd,"UserId",row["UserId"]);
			return updateCmd;
		}
		
		protected override void PrepareDataAdapterCommand(Database db,out DbCommand dbInsertCommand,
		                     out DbCommand dbUpdateCommand,out DbCommand dbDeleteCommand)
		{
			dbInsertCommand = db.GetSqlStringCommand(SQL_INSERT);
			#region set insert cmd parameters
			db.AddInParameter(dbInsertCommand, "Useq",DbType.Int32, "USEQ", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "LoginName",DbType.AnsiString, "LOGIN_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "UserCode",DbType.AnsiString, "USER_CODE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ArmType",DbType.AnsiString, "ARM_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SpecialtyPhase",DbType.AnsiString, "SPECIALTY_PHASE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "BranchId",DbType.AnsiString, "BRANCH_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PersonId",DbType.AnsiString, "PERSON_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PersonName",DbType.AnsiString, "PERSON_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SexId",DbType.AnsiString, "SEX_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ForkId",DbType.AnsiString, "FORK_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Birthday",DbType.DateTime, "BIRTHDAY", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "EnrollDate",DbType.DateTime, "ENROLL_DATE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Birthplace",DbType.AnsiString, "BIRTHPLACE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "FamOriId",DbType.AnsiString, "FAM_ORI_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PersonIngId",DbType.AnsiString, "PERSON_ING_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PolityMemberId",DbType.AnsiString, "POLITY_MEMBER_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "CurrentpostId",DbType.AnsiString, "CURRENTPOST_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Currentposttime",DbType.AnsiString, "CURRENTPOSTTIME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "FirstdegreeId",DbType.AnsiString, "FIRSTDEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Schoolspecial",DbType.AnsiString, "SCHOOLSPECIAL", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "CurrentdegreeId",DbType.AnsiString, "CURRENTDEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "StrongSuit",DbType.AnsiString, "STRONG_SUIT", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "DegreeId",DbType.AnsiString, "DEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "TypicalLevel",DbType.AnsiString, "TYPICAL_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "IdentityTypeId",DbType.AnsiString, "IDENTITY_TYPE_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ReadinessId",DbType.AnsiString, "READINESS_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Graduatefrom",DbType.AnsiString, "GRADUATEFROM", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "TrainInfo",DbType.AnsiString, "TRAIN_INFO", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "TrainScore",DbType.AnsiString, "TRAIN_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "TrainEva",DbType.AnsiString, "TRAIN_EVA", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AbilityEva",DbType.AnsiString, "ABILITY_EVA", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Goodteacher",DbType.AnsiString, "GOODTEACHER", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Paper",DbType.AnsiString, "PAPER", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Partyattended",DbType.AnsiString, "PARTYATTENDED", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Personlib",DbType.AnsiString, "PERSONLIB", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Awardorpunish",DbType.AnsiString, "AWARDORPUNISH", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Resume",DbType.AnsiString, "RESUME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Photo",DbType.AnsiString, "PHOTO", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "UserId",DbType.AnsiString, "USER_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "UserPwd",DbType.AnsiString, "USER_PWD", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "FullName",DbType.AnsiString, "FULL_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Posttype",DbType.AnsiString, "POSTTYPE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Zcbm",DbType.AnsiString, "ZCBM", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Zgsf",DbType.AnsiString, "ZGSF", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Enabled",DbType.AnsiString, "ENABLED", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "State",DbType.Int32, "STATE", DataRowVersion.Current);
			#endregion
			dbUpdateCommand = db.GetSqlStringCommand(SQL_UPDATE);
			#region Set update cmd value parameters
			db.AddInParameter(dbUpdateCommand, "Useq", DbType.Int32, "USEQ", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "LoginName", DbType.AnsiString, "LOGIN_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "UserCode", DbType.AnsiString, "USER_CODE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ArmType", DbType.AnsiString, "ARM_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SpecialtyPhase", DbType.AnsiString, "SPECIALTY_PHASE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "BranchId", DbType.AnsiString, "BRANCH_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PersonId", DbType.AnsiString, "PERSON_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PersonName", DbType.AnsiString, "PERSON_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SexId", DbType.AnsiString, "SEX_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ForkId", DbType.AnsiString, "FORK_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Birthday", DbType.DateTime, "BIRTHDAY", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "EnrollDate", DbType.DateTime, "ENROLL_DATE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Birthplace", DbType.AnsiString, "BIRTHPLACE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "FamOriId", DbType.AnsiString, "FAM_ORI_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PersonIngId", DbType.AnsiString, "PERSON_ING_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PolityMemberId", DbType.AnsiString, "POLITY_MEMBER_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "CurrentpostId", DbType.AnsiString, "CURRENTPOST_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Currentposttime", DbType.AnsiString, "CURRENTPOSTTIME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "FirstdegreeId", DbType.AnsiString, "FIRSTDEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Schoolspecial", DbType.AnsiString, "SCHOOLSPECIAL", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "CurrentdegreeId", DbType.AnsiString, "CURRENTDEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "StrongSuit", DbType.AnsiString, "STRONG_SUIT", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "DegreeId", DbType.AnsiString, "DEGREE_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "TypicalLevel", DbType.AnsiString, "TYPICAL_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "IdentityTypeId", DbType.AnsiString, "IDENTITY_TYPE_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ReadinessId", DbType.AnsiString, "READINESS_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Graduatefrom", DbType.AnsiString, "GRADUATEFROM", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "TrainInfo", DbType.AnsiString, "TRAIN_INFO", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "TrainScore", DbType.AnsiString, "TRAIN_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "TrainEva", DbType.AnsiString, "TRAIN_EVA", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AbilityEva", DbType.AnsiString, "ABILITY_EVA", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Goodteacher", DbType.AnsiString, "GOODTEACHER", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Paper", DbType.AnsiString, "PAPER", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Partyattended", DbType.AnsiString, "PARTYATTENDED", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Personlib", DbType.AnsiString, "PERSONLIB", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Awardorpunish", DbType.AnsiString, "AWARDORPUNISH", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Resume", DbType.AnsiString, "RESUME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Photo", DbType.AnsiString, "PHOTO", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "UserPwd", DbType.AnsiString, "USER_PWD", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "FullName", DbType.AnsiString, "FULL_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Posttype", DbType.AnsiString, "POSTTYPE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Zcbm", DbType.AnsiString, "ZCBM", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Zgsf", DbType.AnsiString, "ZGSF", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Enabled", DbType.AnsiString, "ENABLED", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "State", DbType.Int32, "STATE", DataRowVersion.Current);
			#endregion
			#region set update cmd pk where parameters
			db.AddInParameter(dbUpdateCommand, "UserId", DbType.AnsiString, "USER_ID", DataRowVersion.Current);
			#endregion			
			dbDeleteCommand = db.GetSqlStringCommand(SQL_DELETE);
			#region set delete cmd pk where parameters
			db.AddInParameter(dbDeleteCommand, "UserId", DbType.AnsiString, "USER_ID", DataRowVersion.Current);
			#endregion
		}
		#endregion	
		
		#region Delete模块 Helper		
		
		protected override DbCommand ConstructDeleteCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString);
			 
			return dbCommand;
		}		
		protected override DbCommand ConstructDeleteCommand(Database db,MoUsers entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString,entity.UserId);
		 
			return dbCommand;
		}
		
		protected override DbCommand ConstructDeleteCommandForWhere(Database db, string where)
        {
            return db.GetSqlStringCommand(SQL_DELETE_DEFAULT + where);            
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, MoUsers entity)
        {
			db.SetParameterValue(deleteCmd,"UserId",entity.UserId);
			return deleteCmd;
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, DataRow row)
        {
			db.SetParameterValue(deleteCmd,"UserId",row["UserId"]);
			return deleteCmd;
        }      
		
		#endregion helper
		
		#region Query模块 Helper

        protected override DbCommand ConstructQueryCommand(string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }

        #endregion
		
		#region GetEntity(s)模块 Helper
        
		protected override DbCommand ConstructSelectOneCommand(Database db,MoUsers entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_SELECT_ONE);
			 
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString,entity.UserId);
			return dbCommand;
		}
		
		protected override void PopulateEntityByDataReader(IDataReader reader,ref MoUsers entity)
		{
			if (!reader.IsDBNull(0)) entity.Useq = reader.GetInt32(0);
			if (!reader.IsDBNull(1)) entity.LoginName = reader.GetString(1);
			if (!reader.IsDBNull(2)) entity.UserCode = reader.GetString(2);
			if (!reader.IsDBNull(3)) entity.ArmType = reader.GetString(3);
			if (!reader.IsDBNull(4)) entity.SpecialtyPhase = reader.GetString(4);
			if (!reader.IsDBNull(5)) entity.BranchId = reader.GetString(5);
			if (!reader.IsDBNull(6)) entity.PersonId = reader.GetString(6);
			if (!reader.IsDBNull(7)) entity.PersonName = reader.GetString(7);
			if (!reader.IsDBNull(8)) entity.SexId = reader.GetString(8);
			if (!reader.IsDBNull(9)) entity.ForkId = reader.GetString(9);
			if (!reader.IsDBNull(10)) entity.Birthday = reader.GetDateTime(10);
			if (!reader.IsDBNull(11)) entity.EnrollDate = reader.GetDateTime(11);
			if (!reader.IsDBNull(12)) entity.Birthplace = reader.GetString(12);
			if (!reader.IsDBNull(13)) entity.FamOriId = reader.GetString(13);
			if (!reader.IsDBNull(14)) entity.PersonIngId = reader.GetString(14);
			if (!reader.IsDBNull(15)) entity.PolityMemberId = reader.GetString(15);
			if (!reader.IsDBNull(16)) entity.CurrentpostId = reader.GetString(16);
			if (!reader.IsDBNull(17)) entity.Currentposttime = reader.GetString(17);
			if (!reader.IsDBNull(18)) entity.FirstdegreeId = reader.GetString(18);
			if (!reader.IsDBNull(19)) entity.Schoolspecial = reader.GetString(19);
			if (!reader.IsDBNull(20)) entity.CurrentdegreeId = reader.GetString(20);
			if (!reader.IsDBNull(21)) entity.StrongSuit = reader.GetString(21);
			if (!reader.IsDBNull(22)) entity.DegreeId = reader.GetString(22);
			if (!reader.IsDBNull(23)) entity.TypicalLevel = reader.GetString(23);
			if (!reader.IsDBNull(24)) entity.IdentityTypeId = reader.GetString(24);
			if (!reader.IsDBNull(25)) entity.ReadinessId = reader.GetString(25);
			if (!reader.IsDBNull(26)) entity.Graduatefrom = reader.GetString(26);
			if (!reader.IsDBNull(27)) entity.TrainInfo = reader.GetString(27);
			if (!reader.IsDBNull(28)) entity.TrainScore = reader.GetString(28);
			if (!reader.IsDBNull(29)) entity.TrainEva = reader.GetString(29);
			if (!reader.IsDBNull(30)) entity.AbilityEva = reader.GetString(30);
			if (!reader.IsDBNull(31)) entity.Goodteacher = reader.GetString(31);
			if (!reader.IsDBNull(32)) entity.Paper = reader.GetString(32);
			if (!reader.IsDBNull(33)) entity.Partyattended = reader.GetString(33);
			if (!reader.IsDBNull(34)) entity.Personlib = reader.GetString(34);
			if (!reader.IsDBNull(35)) entity.Awardorpunish = reader.GetString(35);
			if (!reader.IsDBNull(36)) entity.Resume = reader.GetString(36);
			if (!reader.IsDBNull(37)) entity.Photo = reader.GetString(37);
			if (!reader.IsDBNull(38)) entity.UserId = reader.GetString(38);
			if (!reader.IsDBNull(39)) entity.UserPwd = reader.GetString(39);
			if (!reader.IsDBNull(40)) entity.FullName = reader.GetString(40);
			if (!reader.IsDBNull(41)) entity.Posttype = reader.GetString(41);
			if (!reader.IsDBNull(42)) entity.Zcbm = reader.GetString(42);
			if (!reader.IsDBNull(43)) entity.Zgsf = reader.GetString(43);
			if (!reader.IsDBNull(44)) entity.Enabled = reader.GetString(44);
			if (!reader.IsDBNull(45)) entity.State = reader.GetInt32(45);
		}
		
		

        protected override DbCommand ConstructSelectConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }
		
		#endregion	
		
		#region Count模块 Helper

        protected override DbCommand ConstructCountCommand(Database db)
        {
            return db.GetSqlStringCommand(SQL_COUNT);
        }

        protected override DbCommand ConstructCountConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_COUNT + condition);
        }

		#endregion
		
		#region IsExist模块 Helper

        protected override DbCommand ConstructIsExistCommand(Database db, MoUsers entity)
        {
            DbCommand dbCommand = db.GetSqlStringCommand(SQL_EXIST);
			db.AddInParameter(dbCommand,"UserId",DbType.AnsiString,entity.UserId);
			return dbCommand;
        }

		#endregion

		
		
	}
}	
#endregion

